using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Colman.Rpg.Connection;

namespace Colman.Rpg
{
    /// <summary>
    /// RPG - Client Main.
    /// </summary>
    public static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            LoginForm login = new LoginForm();
            Application.Run(login);

            if (login.DialogResult == DialogResult.OK)
            {
                Application.Run(new MenuForm());

                ClientEndPoint.Instance.LogOffUser(ClientEndPoint.Instance.UserName);
                ClientEndPoint.Dispose();
            }
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            System.Diagnostics.Debugger.Break();
        }
    }
}
